<%@page import="java.io.PrintWriter"%>
<%@page import="java.sql.ResultSet" import="java.sql.Statement" import="java.sql.Connection" import="connection.DBConnection"%>
<%@page import="java.util.*" %>
<%@page import="java.text.SimpleDateFormat" %> 
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sales Voucher</title>
<%--
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

--%>

<LINK REL=StyleSheet HREF="dimming.css" TYPE="text/css">

<SCRIPT LANGUAGE="JavaScript" SRC="dimmingdiv.js">
</SCRIPT>

<style>
		
div.dimmer {
	visibility: hidden;
	position:absolute;
	left:0px;
	top:0px;
	font-family:verdana;
	font-weight:bold;
	padding:40px;

	background-image:url(honey.png);
	/* ieWin only stuff */
	_background-image:none;
	_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='honey.png');
}


div.dimming {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-style: normal;
	background-color: #ffffff;
	position:absolute;
	/* set z-index higher than possible */
	z-index:10000;
	visibility: hidden;
	
	border-style: solid;
	border-color: #999999;
	border-width: 1px;

}

table.floatingHeader {
	background-color: #0000ff;
	color:#ffffff;
}
</style>


<script type="text/javascript" src="JS/jquery-1.4.2.min.js"></script>

<script  type="text/javascript">

	$(document).ready(function() 
	{
    	$('#enter1').click(function(e) 
    	{
    		alert("hiiii");
       		e.preventDefault();
 
       		var ajaxdata = $("#customername").val();
       		var ajaxdata1 = $("#customercode").val();
       		var ajaxdata2 = $("#customeraddress").val();
 			var ajaxdata3 = $("#customercity").val();
  			var ajaxdata4 = $("#customerstate").val();
		    var ajaxdata5 = $("#customertin").val();
		    var ajaxdata6 = $("#customerpan").val();
		    var ajaxdata7 = $("#customermobile").val();
		    var ajaxdata8 = $("#customeremail").val();
		    var ajaxdata9 = $("#customercontactperson").val();
		    var ajaxdata10 = $("#copeningbalance").val();
  
   			var value ='customername='+ ajaxdata +'&customercode='+ ajaxdata1 +'&customeraddress='+ ajaxdata2 +'&customercity='+ ajaxdata3 +'&customerstate='+ ajaxdata4 +'&customertin='+ ajaxdata5 +'&customerpan='+ ajaxdata6 +'&customermobile='+ ajaxdata7 +'&customeremail='+ ajaxdata8 +'&customercontactperson='+ ajaxdata9 +'&copeningbalance='+ ajaxdata10 ;
   			
   			alert(value);
   
		$.ajax({
   		     type:"get",  //post method
	         url: "CustomerMasterServlet", //ajaxformexample url
	         data: value, //
			 cache: false,
			 success: function(data) 
			 {

				 // $("#country").val('');
				//  $("#message").html(data).slideDown('slow');
   
  				 $('.success').fadeIn(200).show();
				 $('.error').fadeOut(200).hide();
   			  }
			                                                               
   			});
       
  		 return false;
		});
   }); 

</script>



<div style="width: 518px; height: 287px; id="windowcontent">

<form  name="f1" action="CustomerMasterServlet" method=get enctype="multipart/form-data"> 

<input type="hidden" name="jspname" value="SalesVoucher2.jsp">
<table>
	
<tr>
	<th>	</th>
	<th>	</th>
</tr>

<tr>
	<td> Customer Name </td>
	<td> <input type="text" name="customername" id="customername"> </td>
</tr>

<tr>
	<td> Customer Code </td>
	
		<%
		
		DBConnection dbc=new DBConnection();	
	 	Connection con=dbc.getNewConnection();
	 	String code2="C1";

		Statement st = null;
		ResultSet rs = null;

			try
			{
			
			   st=con.createStatement() ;
       		   rs=st.executeQuery("select ccode from CustomerMaster"); %>
       		   
       		 <%  while(rs.next()) 
       		 	{ 
       				String code1=rs.getString(1);
       				
       			   String[] part = code1.split("(?<=\\D)(?=\\d)");
	   		       
	   		       String p0=part[0];		       
	   		       int p1=Integer.parseInt(part[1]);
	   		      
	   		       p1++;
	   		       
	   		       code2=p0+""+p1;

            	} %>
  
	 		<% }
		   catch(Exception e){} %>
		
	<td> <input type="text" id="customercode" name="customercode" value="<%=code2 %>" > </td>
</tr>

<tr>
	<td> Address</td>
	<td> <input type="text" id="customeraddress" name="customeraddress"> </td>
</tr>

<tr>
	<td> City </td>
	<td> <input type="text" id="customercity" name="customercity"> </td>
</tr>

<tr>
	<td> State </td>
	<td> <input type="text" id="customerstate" name="customerstate"> </td>
</tr>

<tr>
	<td> TIN Number </td>
	<td> <input type="text" id="customertin" name="customertin"> </td>
</tr>

<tr>
	<td> PAN Number</td>
	<td> <input type="text" id="customerpan" name="customerpan"> </td>
</tr>

<tr>
	<td> Mobile Number</td>
	<td> <input type="text" id="customermobile" name="customermobile"> </td>
</tr>

<tr>
	<td> Email ID </td>
	<td> <input type="text" id="customeremail" name="customeremail"> </td>
</tr>

<tr>
	<td> Contact Person Name </td>
	<td> <input type="text" id="customercontactperson" name="customercontactperson"> </td>
</tr>

<tr>
	<td> Opening Balance </td>
	<td> <input type="text" id="copeningbalance" name="copeningbalance"> </td>
</tr>

<tr>
	
	<td> <input type="button" id="enter1" name="enter1" value="Submit"> </td>
</tr>

</table>

</form>
</div>


</body>
</html>